home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-2.iso / Files II / Prog / D-G / FORTRAN Goodies.sit / FORTRAN Goodies / Asin.txt / Asin.txt
Encoding:
Text File  |  1991-08-16  |  2.0 KB  |  102 lines  |  [TEXT/MPS ]

  1. c****************************************c
  2. c
  3. c  ASIN   
  4. c
  5. c    ArcSin returns an angle expressed in radians
  6. c    for any x where -1<= x <= 1
  7. c
  8. c                                                         
  9. c    Wild Things ASIN                                       
  10. c  © 1989 Language Systems Corporation                     
  11. c    All Rights reserved                                     
  12. c
  13. c****************************************c
  14. c    USAGE:
  15. c    ASIN (theValue)   
  16. c
  17. c  This XFCN uses only standard glue routines.
  18. c****************************************c
  19. c  use these commands to compile and link:
  20. c
  21. !!IFC FALSE
  22.  
  23. fortran ASIN.f
  24.  
  25. link -rt XFCN=5002 -w -m ASIN ∂
  26. -sn Main=ASIN ∂
  27. -sn f_RunTime=ASIN ∂
  28. -sn f_Intrinsics=ASIN ∂
  29. ASIN.f.o ∂
  30. "{FLibraries}"FORTRANLib.o ∂
  31. "{FLibraries}"IntrinsicLib.o ∂
  32. "{Libraries}"Interface.o ∂
  33. "{Libraries}"Runtime.o ∂
  34. -o testStack
  35.  
  36. delete ASIN.f.o
  37.  
  38. !!ENDC
  39. c
  40. c****************************************
  41. c
  42.     subroutine ASIN(param)
  43.  
  44. c load the system calls
  45.  
  46. !!m inlines.f
  47.  
  48. c include the header file
  49.  
  50. !!I HyperXCmd.f
  51.  
  52. c data declarations
  53. c
  54.     record        /XCmdData/ param
  55.     pointer        /integer*4/ theHandle
  56.     extended    theValue,theAngle
  57.     string        theString
  58.  
  59. c check parameters
  60.  
  61.     if (param.paramCount <> 1) then
  62.         call sysbeep(9)
  63.         theString = 'answer "ASIN requires 1 argument."'
  64.         call SendCardMessage(param,theString)
  65.         return
  66.     end if
  67.  
  68. c convert arguments
  69.  
  70.     theHandle = param.params(1).ch
  71.     call HLock(%val(theHandle))
  72.     theString = ZeroToPas(param,theHandle^)
  73.     theValue = StrToExt(param,theString)
  74.     call HUnLock(%val(theHandle))
  75.  
  76. c check to make sure data is valid
  77.  
  78.     If ((theValue < -1.0) .OR. (theValue > 1.0)) then
  79.         theString = 'answer "Argument for ASIN must be -1 <= x <= 1."'
  80.         call SendCardMessage(Param,theString)
  81.         return
  82.     end if
  83.  
  84. c process arguments
  85. c    note: use the type-specific call (QASIN) because
  86. c    the generic call (ASIN) is the same as this subroutine.
  87.  
  88.     theAngle = QASIN(theValue)
  89.  
  90. c prepare to return
  91.  
  92.     theString = ExtToStr(param,theAngle)
  93.     param.returnValue.ch = PasToZero(param,theString)
  94.     return
  95.     end
  96.  
  97. c include the glue routines
  98.  
  99. !!I XCmdGlue.f
  100. c
  101. c****************************************c
  102.